<template>
  <div class="app-container ">
    <el-form ref="form" size="small" :model="form" :rules="rules" label-width="180px" style="background: rgb(255, 255, 255);width: 550px;height: 600px;margin: 0px 0px 0px 500px;border-radius: 10px;">
      <el-tabs v-model="activeName">
        <el-tab-pane style="padding-top:10px" label="" name="城市代理设置">
          <el-row>
            <el-col :span="24">
              <el-form-item label="城市代理默认返佣比例%">
                <el-input v-model="form.return_percent" style="width:100px;" auto-complete="off" clearable placeholder="请输入默认佣金比例">
                 <!-- <template slot="append">%</template> -->
                </el-input>
                <div class="help-block">城市代理默认返佣比例</div>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row  style="display: none">
            <el-col :span="24">
              <el-form-item label="提现方式">
                <el-radio-group v-model="form.pay_type">
                  <el-radio label="bank">银行卡</el-radio>
                  <el-radio label="wechat">微信支付</el-radio>
                  <el-radio label="alipay">支付宝</el-radio>
                  <el-radio label="remaining_sum">提现到余额</el-radio>
                </el-radio-group>
                <div class="help-block">微信自动支付，需要申请微信支付的企业付款到零钱功能</div>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="最少提现额度(元)">
                <el-input
                  v-model="form.min_money"
                  style="width:100px;"
                  auto-complete="off"
                  clearable
                  placeholder="请输入最少提现额度"
                >
                 <!-- <template slot="append">元</template> -->
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="每日提现上限(元)">
                <el-input
                  v-model="form.cash_max_day"
                  style="width:100px;"
                  auto-complete="off"
                  clearable
                  placeholder="请输入每日提现上限"
                >
                  <!-- <template slot="append">元</template> -->
                </el-input>
                <div class="help-block">0元表示不限制每日提现金额</div>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="提现手续费%">
                <el-input
                  v-model="form.cash_service_charge"
                  style="width:100px;"
                  auto-complete="off"
                  clearable
                  placeholder="请输入提现手续费"
                >
                 <!-- <template slot="append">%</template> -->
                </el-input>
                <div class="help-block">0表示不设置提现手续费
                  <span class="text-danger">提现手续费额外从提现中扣除</span><br>
                  例如：<span class="text-danger">10%</span>的提现手续费：<br>
                  提现<span class="text-danger">100</span>元，扣除手续费<span class="text-danger">10</span>元，
                  实际到手<span class="text-danger">90</span>元
                </div>
              </el-form-item>
            </el-col>
          </el-row>
        </el-tab-pane>
      </el-tabs>
      <el-form-item>
        <el-button size="small" type="primary" @click="submit">保存设置</el-button>
      </el-form-item>
    </el-form>

  </div>
</template>
<script>
export default {
  name: 'Configoperatingcity',
  components: {},
  data() {
    return {
      form: {
      },
      loading: false,
      activeName: '城市代理设置',
      rules: {}
    }
  },
  mounted() {
    this.$api.post('/config/getInfo', {
      mo: 'operatingcity'
    }).then(res => {
      this.form = JSON.stringify(res.data) == '[]' ? {} : res.data
      this.setDefaultVal('keyword')
    })
  },
  methods: {
    submit() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          this.loading = true
          this.$api.post('/config/update', this.form).then(res => {
            this.$message({
              message: '操作成功',
              type: 'success'
            })
          }).catch(() => {
            this.loading = false
          })
        }
      })
    },
    setDefaultVal(key) {
      if (this.form[key] == null || this.form[key] == '') {
        this.form[key] = []
      }
    }
  }
}
</script>


<style scoped>
::v-deep .el-input__inner {
    -webkit-appearance: none;
    background-color: #FFFFFF;
    background-image: none;
    border-radius: 50px;
    border: 1px solid #DCDFE6;
    box-sizing: border-box;
    color: #606266;
    display: inline-block;
    font-size: inherit;
    height: 30px;
    line-height: 40px;
    outline: none;
    padding: 0 15px;
    transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
    width: 100%;
}

::v-deep  .el-tabs__nav-wrap::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 0px;
    background-color: #ffffff;
    z-index: 1;
}

::v-deep .el-tabs__header {
    padding-left: 20px;
    height: 0px;
}

</style>